/**
 * Created by weikexin .
 * description:
 **/
import {HTTP} from '../util/http'

class Balance extends HTTP {
	withdrawal (params, success) {
		let url = 'CashWithdrawal/GetWithdrawals'
		let data = Object.assign({},
			params,
			{
				user_id:  wx.getStorageSync('userInfo').user_id || 0
			})
		this.request({
			url: url,
			data: data,
			oldURL: true,
			success
		})
	}

	withdrShow (params, success) {
		let url = 'UserBase/GetWithdShow'
		let data = Object.assign({},
			params,
			{
				user_id:  wx.getStorageSync('userInfo').user_id || 0
			})
		this.request({
			url: url,
			data: data,
			oldURL: true,
			success
		})
	}

	addAccount (params, success) {
		let url = 'CashWithdrawal/GetAddAccount'
		let data = Object.assign({},
			params,
			{
				user_id:  wx.getStorageSync('userInfo').user_id || 0
			})
		this.request({
			url: url,
			data: data,
			oldURL: true,
			success
		})
	}

	accountList (success) {
		let url = 'CashWithdrawal/GetAlipayAccount'
		let data = Object.assign({},
			{
				user_id:  wx.getStorageSync('userInfo').user_id || 0,
				type: 1
			})
		this.request({
			url: url,
			data: data,
			oldURL: true,
			success
		})
	}

	delAccount (params, success) {
		let url = 'CashWithdrawal/GetDelAlipayAccount'
		let data = Object.assign({},
			params,
			{
				user_id:  wx.getStorageSync('userInfo').user_id || 0,
				type: 1
			})
		this.request({
			url: url,
			data: data,
			oldURL: true,
			success
		})
	}

	getMyBalance(params, success) {
		let url = 'UserBase/GetMyBalance'
		let data = Object.assign({},
			params,
			{
				user_id: wx.getStorageSync('userInfo').user_id,
			})
		this.request({
			url,
			data,
			oldURL: true,
			success
		})
	}
}

export { Balance }
